import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: happyiu
 * Date: 2022-02-18
 * Time: 14:37
 * Description:
 */
public class TestDemo {

    public static void main1(String[] args) {
        Map<String,String> map = new HashMap<>();
        map.put("千金","安娜-谢尔巴科娃");
        map.put("莎莎","特鲁索娃");
        map.put("K宝","瓦利耶娃");

        String ret = map.get("千金");
        System.out.println(ret);

        System.out.println(map.get("天天"));
        System.out.println(map.getOrDefault("天天","金博洋"));

    }

    public static void main2(String[] args) {
        Map<String,String> map = new HashMap<>();
        map.put("千金","安娜-谢尔巴科娃");
        map.put("莎莎","特鲁索娃");
        map.put("K宝","瓦利耶娃");

         boolean flg = map.containsKey("千金");
         System.out.println(flg);
         boolean flg2 = map.containsValue("莎莎");
        System.out.println(flg2);
    }

    public static void main3(String[] args) {
        Map<String,String> map = new HashMap<>();
        map.put("千金","安娜-谢尔巴科娃");
        map.put("莎莎","特鲁索娃");
        map.put("K宝","瓦利耶娃");

        Set<Map.Entry<String,String>> entrySet = map.entrySet();


    }

    public static void main(String[] args) {
        Map<String,String> map = new HashMap<>();
        map.put("千金","安娜-谢尔巴科娃");
        map.put("莎莎","特鲁索娃");
        map.put("K宝","瓦利耶娃");

        Set<Map.Entry<String,String>> entrySet = map.entrySet();
        for (Map.Entry<String,String> entry:
             entrySet) {
            System.out.println("key:"+entry.getKey()+"   value:"+entry.getValue());
        }

    }
}
